home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / net / tf02.lha / TinyFugue / tf-lib / kbregion.tf < prev    next >
Text File  |  1995-08-12  |  1KB  |  51 lines

  1. ;;; cut/copy/paste input region
  2. ;;; this file is incomplete
  3.  
  4. /~loaded kbregion.tf
  5.  
  6. /def -ib'^x@'    = /kb_set_mark
  7. /def -ib'^xx'    = /kb_cut_region
  8. /def -ib'^x<'    = /kb_copy_region
  9. /def -ib'^x>'    = /kb_paste_buffer
  10. /def -ib'^x^x'    = /kb_exchange_point_and_mark
  11.  
  12. /set _kb_mark=-1
  13.  
  14. /def -i kb_set_mark = \
  15.     /set _kb_mark=$[kbpoint()]%;\
  16.     /echo %% First mark set at position %{_kb_mark}.
  17.  
  18. /def -i kb_exchange_point_and_mark = \
  19.     /if ( _kb_mark > 0 ) \
  20.         /let point=$[kbpoint()]%;\
  21.         /test kbgoto(_kb_mark)%;\
  22.         /set _kb_mark=%point%;\
  23.     /else \
  24.         /echo %% Mark not set.%;\
  25.     /endif%;\
  26.  
  27. /def -i kb_copy_region = \
  28.     /if ( _kb_mark > 0 ) \
  29.         /set _kb_region=%;\
  30.         /if ( _kb_mark > kbpoint() ) \
  31.             /test _kb_region := substr(kbtail(), 0, kbpoint() - _kb_mark)%;\
  32.         /else \
  33.             /test _kb_region := substr(kbhead(), _kb_mark, kbpoint())%;\
  34.         /endif%;\
  35.         /echo %% Region copied into buffer.%;\
  36.         /set _kb_mark=-1%;\
  37.     /else \
  38.         /echo %% Mark not set.%;\
  39.     /endif%;\
  40.  
  41. /def -i kb_cut_region = \
  42.     /if ( _kb_mark > 0 ) \
  43.         /let mark=%{_kb_mark}%;\
  44.         /kb_copy_region%;\
  45.         /test kbdel(mark)%;\
  46.     /endif
  47.  
  48. /def -i kb_paste_buffer = \
  49.     /test input(_kb_region)
  50.  
  51.